package com.itheima_13;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.TreeMap;

public class test_13_3 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
            String [] str={"sdffsd","fzfsds","dsfsd","dasdwd"};
            StringBuilder s=new StringBuilder();
        for (int i = 0; i < str.length; i++) {
           s.append(str[i]);
        }
            TreeMap<String,Integer> tm=new TreeMap<>();
        String s1 = s.toString();
        char[] chars = s1.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            String te=chars[i]+" ";
            int cont=0;
            for (int j = 0; j < chars.length; j++) {
                if(te.equals(chars[j]+" ")){
                    cont++;
                }
            }
            tm.put(te,cont);
        }
        System.out.println(tm);
    }
}
